package thread;

public class Demo8 {
    public static void main(String[] args) throws InterruptedException {
        //线程的入口方法里的逻辑结束 系统中对应的线程就随之销毁
        //但是 t 对象仍然存在 thread 生命周期与 线程生命周期不一样
        Thread t=new Thread(()->{
            for (int i = 0; i < 3; i++) {
                System.out.println("Hello t");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"t1");
        System.out.println(t.isAlive());//还没有创建线程
        t.start();
/*        System.out.println(t.getPriority());
        System.out.println(t.getId());
        System.out.println(t.getName());*/
        while (true){
            System.out.println(t.isAlive());
            Thread.sleep(1000);
        }
    }
}
